local xurui = fk.CreateSkill {
  name = "lingling__xurui",
}

Fk:loadTranslationTable{
  ["lingling__xurui"] = "蓄锐",
  [":lingling__xurui"] = "回合结束时，你可以摸一张牌。若你本回合未对其他角色使用牌，改为摸两张牌。",
}

xurui:addEffect(fk.TurnEnd, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(xurui.name)
  end,
  on_use = function(self, event, target, player, data)
    if #player.room.logic:getEventsOfScope(GameEvent.UseCard, 1, function (e)
          local use = e.data
          if use.from == player and table.find(use.tos, function(p)
            return p ~= player
          end) then
            return true
          end
        return false
    end, Player.HistoryTurn) == 0 then
      player:drawCards(2, xurui.name)
    else
      player:drawCards(1, xurui.name)
    end
  end,
})

return xurui
